﻿using System;
using System.Web;

namespace YouthCMS.errors
{
    public partial class PageNotFound : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                // At this point we have information about the error
                var ctx = HttpContext.Current;

                var exception = ctx.Server.GetLastError();

                string errorInfo =
                      "<br>Offending URL: " + ctx.Request.Url.ToString() +
                      "<br>Source: " + exception.Source +
                      "<br>Message: " + exception.Message +
                      "<br>Stack trace: " + exception.StackTrace;
                errorPageLabel.Text = errorInfo;
            }
            catch (Exception ex)
            {
                errorPageLabel.Text = ex.Message;
            }
            
        }
    }
}